<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>参数类型列表</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <link rel="stylesheet" href="../lib/layui-v2.5.5/css/layui.css" media="all">
    <link rel="stylesheet" href="../css/public.css" media="all">
</head>
<body>
<div class="layuimini-container">
    <div class="layuimini-main">

        <fieldset class="table-search-fieldset">
            <legend>搜索信息</legend>
            <div style="margin: 10px 10px 10px 10px">
                <form class="layui-form layui-form-pane" action="">
                    <div class="layui-form-item">
                        <div class="layui-inline">
                            <label class="layui-form-label">参数类型</label>
					        <div class="layui-input-block">
					            <select name="parameterType" lay-filter="parameterType" id="parameterType">                     
					            </select>
					        </div>
                        </div>                                                               
                        <div class="layui-inline">
                            <button type="submit" class="layui-btn layui-btn-primary"  lay-submit lay-filter="data-search-btn"><i class="layui-icon"></i> 搜 索</button>
                        </div>
                    </div>
                </form>
            </div>
        </fieldset>       
        <table class="layui-hide" id="currentTableId" lay-filter="currentTableFilter"></table>      
    </div>
</div>
<script src="../lib/layui-v2.5.5/layui.js" charset="utf-8"></script>
<script>
    layui.use(['form', 'table'], function () {
        var $ = layui.jquery,
            form = layui.form,
            laydate=layui.laydate,
            table = layui.table;             

      //加载下拉列表
        layer.ready(function(){
        	$.ajax({
                type : "POST",
                url : "../parameter/getParameterType",
                contentType: "application/json;charset=utf-8",
                data : JSON.stringify({"parameterType":""}),
                dataType: "json",
                success : function(result) {
	     		    var data=result.data;
	     		    var info = "<option value=''>请选择</option>";
	     		    for (var i = 0; i < data.length; i++) {    
	     		        info += "<option value=" + data[i].parameterType + ">" + data[i].typeName + "</option>";        
	     		    }
	     		    $("#parameterType").append(info);
	     		    form.render('select');
                }    
     		 });
         }); 
        
        table.render({
            elem: '#currentTableId',
            url: '../parameter/getParameterType',
            toolbar: '#toolbarDemo',
            contentType: "application/json",
            method: 'POST',
            defaultToolbar: ['filter', 'exports', 'print'],
            cols: [[
                {field: 'id', title: 'ID',hide:true,align: "center"},
                {field: 'typeName',title: '参数类型名称',align: "center"},
                {field: 'parameterType',title: '参数类型标识',align: "center"}                              
            ]],            
            skin: 'line'
        });

        // 监听搜索操作
        form.on('submit(data-search-btn)', function (data) {
            //执行搜索重载
            table.reload('currentTableId', {
                where: data.field
            }, 'data');

            return false;
        });  
    });
</script>

</body>
</html>